﻿Imports extremo

Public Class ReservasEditar
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then

            Dim id = Request.Params.Get("id")

            Dim negocio = New ReservaNegocio
            Dim modelo = negocio.obtener(id)

            Me.txtidreserva.Value = modelo.idreserva
            Me.txtdeporte.Text = modelo.deporte
            Me.txtcantidad.Text = modelo.cantidad
            Me.txtfecha_reserva.Text = modelo.fecha_reserva
            Me.txtidevento.Text = modelo.idevento
            Me.txtidusuario.Text = modelo.idusuario
        End If
    End Sub

    Protected Sub btnGuardar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnGuardar.Click
        Try
            Dim negocio = New ReservaNegocio
            negocio.actualizar(Me.txtidreserva.Value, Me.txtdeporte.Text, Me.txtcantidad.Text, Me.txtfecha_reserva.Text, Me.txtidevento.Text, Me.txtidusuario.Text)

            Response.Redirect("Reservas.aspx", True)
        Catch ex As Exception
            Response.Write("No se pudo actualizar")
        End Try
    End Sub

    Protected Sub btnRegresar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnRegresar.Click
        Response.Redirect("Reservas.aspx", True)
    End Sub
End Class